package com.sky.mapper;

import com.sky.entity.Dish;
import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 老杨
 * @version 1.0
 */
@Mapper
public interface SetmealDishMapper {

    /**
     * 根据菜品id 集合 看是否 会返回 关联套餐
     * @param ids
     * @return
     */
    List<Long> getSetmealIdBydishId(List<Long> ids);

    /**
     * 根据 套餐id 添加和 套餐关联的菜品
     * @param setmealDishes
     */
    void addSetmeal(List<SetmealDish> setmealDishes);

    /**
     * 根据 套餐id 删除 关联的菜品
     * @param id
     */
    @Delete("delete from setmeal_dish where setmeal_id = #{id}")
    void delete(Long id);

    /**
     * 根据 套餐 id 返回 关联 的菜品
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where dish_id = #{id}")
    List<Dish> getDishIdBySetmealId(Long id);

    @Select("select * from setmeal_dish where dish_id = #{id}")
    List<SetmealDish> getSetmealBydishId(Long id);
}
